home *** CD-ROM | disk | FTP | other *** search
- unit LinkFileU;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- ExtCtrls;
-
- type
- TForm1 = class(TForm)
- Image1: TImage;
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- {$L Image.obj} //Link in data file
-
- //Declare symbol that marks start of data in linked data file
- procedure _AthenaImage; external;
-
- //Interposer class to access protected methods of TMemoryStream
- type
- TMemoryStream = class(Classes.TMemoryStream);
-
- procedure TForm1.FormCreate(Sender: TObject);
- var
- MS: TMemoryStream;
- PBMF: PBitmapFileHeader;
- begin
- MS := TMemoryStream.Create;
- try
- //Bitmap file header is at start of a bitmap file
- PBMF := @_AthenaImage;
- //Tell memory stream where the memory is, and how much there is
- MS.SetPointer(@_AthenaImage, PBMF^.bfSize);
- //Load image data into TImage component
- Image1.Picture.Bitmap.LoadFromStream(MS)
- finally
- MS.Free
- end
- end;
-
- end.
-